#pragma once
#include <QWidget>
#include "HDBase/DList.hpp"


struct StatisticsNode
{
	double value;
	QString valueName;
	QString name;
	QColor color;
};


class QStatisticsWidget : public QWidget
{
	Q_OBJECT

public:
	enum Type
	{
		Line,
		Rect,
		Pie
	};

	QStatisticsWidget(QWidget *parent = Q_NULLPTR);
	~QStatisticsWidget();
	void setType(Type t);
	Type getType() { return type_; }
	void setData(const DList<StatisticsNode>& datas);

protected:
	virtual void paintEvent(QPaintEvent* event) override;

private:
	void refresh();

	Type type_;
	DList<StatisticsNode> datas_;
};
